﻿namespace ApiTemplate.Entity.Base
{
    /// <summary>
    /// 自定义业务异常
    /// </summary>
    public class BusinessException : Exception
    {
        /// <summary>
        /// 自定义异常
        /// </summary>
        /// <param name="code"></param>
        /// <param name="msg"></param>
        public BusinessException(ErrorCode code, string msg)
        {
            Code = code;
            ErrorMessage = msg;
        }

        /// <summary>
        /// 补充默认构造
        /// </summary>
        public BusinessException()
        {

        }
        /// <summary>
        /// 业务错误信息
        /// </summary>
        public string ErrorMessage { get; set; }

        /// <summary>
        /// 错误代码（方便管理可以使用枚举）
        /// </summary>
        public ErrorCode Code { get; set; }

    }
}
